<?php
/**
 + Created by:	Webit Solution
 * Company:		Al-Barr Technologies
 + Contact:		www.al-barr.com , info@al-barr.com
			www.webitsolution.com, developer@webitsolution.com
 * Created on:	Oct 29th, 2012
 ^
 + Project: 		WRecruit 
 * File Name:	module/jssresumeearch.php
 ^ 
 * Description: Module for WRecruit
 ^ 
 * History:		NONE
 ^ 
 */

defined('_JEXEC') or die('Restricted access');

$document = &JFactory::getDocument();
//$document->addScript( JURI::base() . '/includes/js/joomla.javascript.js');

$sh_title = $params->get('title', 1);
$sh_name = $params->get('name', 1);
$sh_nationality = $params->get('natinality', 1);
$sh_gender = $params->get('gender', 1);
$sh_iamavailable = $params->get('iamavailable', 1);

$sh_category = $params->get('category', 1);
$sh_jobtype = $params->get('jobtype', 1);
$sh_salaryrange = $params->get('salaryrange', 1);
$sh_heighesteducation = $params->get('heighesteducation', 1);
$sh_experience = $params->get('experience', 1);
$colperrow = $params->get('colperrow', 3);


$colwidth = Round(100/$colperrow,1);
$colwidth = $colwidth.'%';
$colcount = 1;

//scs				
if($params->get('Itemid')) $itemid = $params->get('Itemid');			
else  $itemid =  JRequest::getVar('Itemid');
//sce
$componentAdminPath = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_wrecruit';
$componentPath =  'components' . DS . 'com_wrecruit';
$divclass=array('odd','even');

require_once $componentPath . DS . 'models' . DS . 'mpwrecruit.php';
$config = array(
	'table_path' => $componentAdminPath . DS . 'tables'
);
$model = new WRecruitModelMpWRecruit($config);
$result = $model->resumesearch($sh_gender,$sh_nationality,$sh_category,$sh_jobtype,$sh_heighesteducation,$sh_salaryrange);

$gender = $result[0];
$nationality = $result[1];
$job_categories = $result[2];
$job_type = $result[3];
$heighest_finisheducation= $result[4];
$salary_range = $result[5];
$currency = $result[6];

?>
<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=resume_searchresults&Itemid='.$itemid); ?>" method="post" name="mrsadminForm" id="mrsadminForm">
	<table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminform">
      <?php if ( $sh_title == 1 ) { ?>
      <tr>
        <td width="<?php echo $colwidth ; ?>" align="left"><?php echo JText::_('JS_APPLICATION_TITLE'); ?>
		<br><input class="inputbox" type="text" name="title" size="27" maxlength="255"  />
        </td>
       <?php } ?>
      <?php if ( $sh_name == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> align="left"><?php echo JText::_('JS_NAME'); ?>
		<br><input class="inputbox" type="text" name="name" size="27" maxlength="255"  />
        </td>
       <?php } ?>
	      <?php if ( $sh_nationality == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> align="left"><?php echo JText::_('JS_NATIONALITY'); ?>
		<br><?php echo $nationality; ?>
        </td>
       <?php } ?>
      <?php if ( $sh_gender == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
			<td  <?php echo $colwidth ; ?> align="left" class="textfieldtitle">	<?php echo JText::_('JS_GENDER');  ?>	
			<br><?php echo $gender;	?>	</td>
       <?php } ?>

      <?php if ( $sh_category == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_CATEGORIES'); ?>
		<br><?php echo $job_categories; ?></td>
       <?php } ?>
      <?php if ( $sh_jobtype == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_JOBTYPE'); ?>
		<br><?php echo $job_type; ?></td>
       <?php } ?>
      <?php if ( $sh_salaryrange == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_SALARYRANGE'); ?>
		<br><?php echo $currency.' '.$salary_range; ?></td>
       <?php } ?>
      <?php if ( $sh_heighesteducation == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_HEIGHTESTEDUCATION'); ?>
		<br><?php echo $heighest_finisheducation; ?></td>
       <?php } ?>
      <?php if ( $sh_experience == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
        <td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_EXPERIENCE'); ?>
		<br><input class="inputbox" type="text" name="experience" size="27" maxlength="25"  /></td>
       <?php } ?>

      <?php if ( $sh_iamavailable == 1 ) { if($colcount == $colperrow){ echo '</tr><tr>'; $colcount = 0; } $colcount++; ?> 
				<td <?php echo $colwidth ; ?> valign="top" align="left"><?php echo JText::_('JS_AVAILABLE'); ?>
				<input type='checkbox' name='iamavailable' value='1'  /></td>
       <?php } ?>
		<?php									
			for($i = $colcount; $i < $colperrow; $i++){
				echo '<td></td>';
			}
			echo '</tr>';
			$colcount=0;
		?>									
	<tr>
		<td colspan="<?php echo $colperrow ;?>" align="center">
		<input type="submit" class="button" name="submit_app" onclick="document.mrsadminForm.submit();" value="<?php echo JText::_('JS_SEARCH_RESUME'); ?>" />
		</td>
	</tr>
    </table>

 			<input type="hidden" name="isresumesearch" value="1" />
			<input type="hidden" name="view" value="employer" />
			<input type="hidden" name="layout" value="resume_searchresults" />
			<input type="hidden" name="uid" value="" />
			<input type="hidden" name="option" value="com_wrecruit" />
			
		  
		  
			  
		</form>

